//
//  APIConfig.swift
//  MyLibrary
//
//  Created by 周博 on 2020/6/17.
//  Copyright © 2020 ncit. All rights reserved.
//

import Foundation
import Alamofire

enum Environment {
    case dev
    case test
    case product
}

let environment: Environment = .product

let appVersion: String = "v2"


private var sub_baseurl: String {
    if environment == .dev {
        return "http://101.132.188.209:11001/"
    } else if environment == .test {
        return "http://101.132.188.209:10088/"
//        return "http://10.88.34.14:10088/"
    } else {
        return "https://www.hundunyun.com.cn/"
    }
}

/** baseUrl */
var baseUrl: String {
    return "\(sub_baseurl)api/\(appVersion)/"
}


/** webview的baseUrl */
var webBaseUrl: String {
    return "https://www.hundunyun.com.cn/yun/"
}


var subBaseUrl_api: String {
    return "\(sub_baseurl)api/"
}


var base_imageUrl: String {
    return "\(subBaseUrl_api)oss/\(appVersion)/file/"
}


var upload_image_url: String {
    return "\(base_imageUrl)upload"
}


// let baseUrl: String = "http://101.132.188.209:11001/api/app-zwo/\(appVersion)/"
// let baseUrl: String = "http://10.88.33.201:11001/api/app-zwo/\(appVersion)/"
// let subBaseUrl: String = "http://101.132.188.209:11001/api/"
// let subBaseUrl: String = "http://10.88.33.201:11001/api/"


///** 图片基础url(获取) */
//let base_imageUrl = "http://101.132.188.209:11001/api/oss/\(appVersion)/file/"
///** 图片上传url */
//let upload_image_url = "http://101.132.188.209:11001/api/oss/\(appVersion)/file/upload"


///** 图片基础url(获取) */
//let base_imageUrl = "http://10.88.33.201:11001/api/oss/\(appVersion)/file/"
///** 图片上传url */
//let upload_image_url = "http://10.88.33.201:11001/api/oss/\(appVersion)/file/upload"

/**
 * 根据图片id获取图片url
 */
func getImageUrlWith(id: Int) -> String {
    return base_imageUrl + "\(id)"
}

/** 是否打印log */
var isPrintLog = true

/** api请求头 */
var headers: HTTPHeaders = [
    "Content-Type": "application/json"
]


/** 是否需要debug接口响应时间 */
let apiNeedDebug: Bool = true 
